class_name Item
extends Area2D

@export var bagItem:BagItem

var picker:Player

# 物品效果
func effect():pass

# 拾取动画
func animate():pass

# 玩家拾取
func collect(bag:Bag):
	await animate()
	bag.add(bagItem)
	queue_free()
	effect()

func _on_body_entered(player:Node2D) -> void:
	if player is Player:
		picker=player
		collect(player.bag)

